upgrade Pinterest-Generated-Client to 0.1.11; fix: support single-e… - #176
Merged
Merged
Conversation
…xception API responses and update integration tests
suihanki
approved these changes
Aug 26, 2026
dfana01
approved these changes
Aug 26, 2026
Contributor
Author
|
Integration tests passing proof: |
dfana01
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem (Why)
Pinterest-Generated-Client0.1.11 models ads bulk responses with a single exception object on each item (exceptionsis not always a list). Campaigns and ad groups still return a list.verify_api_responseonly treated list-shaped exceptions, so ads failures were not turned intoSdkException.Campaign create also now expects campaign-budget optimization on awareness campaigns, and some validation errors surface as raw
ApiException(HTTP 400) instead of the SDK wrappers the tests assumed. Organic cleanup failed on protected boards (401) that cannot be deleted.Solution (What + How)
Pinterest-Generated-Clientfrom0.1.10to0.1.11.verify_api_responseto readexceptionsas either a list or a single object, on both dict and generated-model responses, then raiseSdkExceptionwhencodeandmessageare present.is_campaign_budget_optimization=Trueon awareness campaign creates; acceptApiExceptionwhere the API now validates earlier; skip protected boards in organic cleanup..env.example.Test Plan
python -m pytest tests/src/pinterest/utils/test_error_handling.py— list exceptions, single-object ads exceptions, and dict responses all raiseSdkExceptionmatch_type)PROTECTEDboards